<style>
  .feedback--answer {
    padding:0.8em 2em;
    outline: none;
    border-radius:5px;
    background-color:white;
    display: inline-block;
  }
  .feedback--answer-no {
    margin-left: 1em;
  }
</style>

<p class="feedback--question">Was this page helpful?</p>
<button class="feedback--answer feedback--answer-yes">Yes</button>
<button class="feedback--answer feedback--answer-no">No</button>
<script>
  const yesButton = document.querySelector('.feedback--answer-yes');
  const noButton = document.querySelector('.feedback--answer-no');
  const disableButtons = () => {
    yesButton.disabled = true;
    noButton.disabled = true;
  };
  const sendFeedback = value => {
    if (typeof gtag !== 'function') return;
    gtag('event', 'click', {
      'event_category': 'Helpful',
      'event_label': window.location.pathname,
      'value': value
    });
  };
  yesButton.addEventListener('click', () => {
    disableButtons();
    sendFeedback(1);
  });
  noButton.addEventListener('click', () => {
    disableButtons();
    sendFeedback(0);
  });
</script>
